@extends('layouts._app')
@section('content')
    <body>
    <div class="layui-tab page-content-wrap">
        <div class="layui-form-item">
            <div class="layui-inline tool-btn">
                <a class="layui-btn layui-btn-small layui-btn-primary" id='email-refresh-btn'
                   href="{{route('system.config.index')}}" data-title='刷新'>
                    <i class="layui-icon">&#x1002;</i>
                </a>
            </div>
        </div>
        <ul class="layui-tab-title">
            <li class="layui-this">站点配置</li>
            <li>SEO配置</li>
            <li>发件邮箱</li>
            <li>收件邮箱</li>
            <li>公司信息</li>
            <li>网站图标</li>
            <li>系统数据</li>
        </ul>
        <div class="layui-tab-content">
        @include('layouts._flash')
        <!--站点配置-->
            <div class="layui-tab-item layui-show">
                {!! Form::open(['route' => 'system.config.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','1') !!}
                {!! Form::hidden('submit','2') !!}
                <div class="layui-form-item">
                    {!! Form::label('','网站名称：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('name',"{$config->name}",['id'=>'name','class'=>'layui-input','placeholder'=>'请输入网站名称']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','网站域名：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('url',"{$config->url}",['class'=>'layui-input','placeholder'=>'请输入网站域名']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','站长邮箱：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-inline">
                        {!! Form::email('box',"{$config->box}",['id'=>'email_2','class'=>'layui-input','placeholder'=>'请输入联系邮箱']) !!}
                    </div>
                    <a href="javascript:void(0);" onclick="captcha('0',2,'{{route('code')}}','{{ csrf_token() }}')"
                       id="code_de_2"
                       style="margin:10px;text-align: center">发送验证码</a>
                    <span style="color: red">注：无更改无需发送</span>
                </div>
                <div class="layui-form-item" id="email_code_2" style="display: none;">
                    {!! Form::label('','邮箱验证码：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-inline">
                        {!! Form::text('code','',['id'=>'code_2','class'=>'layui-input','readonly','placeholder'=>'无更改无需填写']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','备案信息：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('record',"{$config->record}",['class'=>'layui-input','placeholder'=>'请输入备案信息']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','版权信息：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('info',"{$config->info}",['class'=>'layui-input','placeholder'=>'请输入版权信息']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'siteInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <!--SEO配置-->
            <div class="layui-tab-item">
                {!! Form::open(['route' => 'system.config.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','2') !!}
                <div class="layui-form-item">
                    {!! Form::label('','SEO标题：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('title',"{$config->title}",['placeholder'=>'请输入seo标题','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','关键字：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('word',"{$config->word}",['placeholder'=>'请输入seo关键字','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    {!! Form::label('','描述：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::textarea('riptive',"{$config->riptive}",['placeholder'=>'请输入seo描述','style'=>'height: -webkit-fill-available;','class'=>'layui-textarea']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'seoInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <!--发件邮箱-->
            <div class="layui-tab-item">
                {!! Form::open(['route' => 'system.config.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','3') !!}
                {!! Form::hidden('submit','3') !!}
                <div class="layui-form-item">
                    {!! Form::label('','邮箱模式：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <input type="radio" name="smtp" value="{{$email->smtp}}" title="SMTP函数发送"
                               @if($email->smtp) checked @endif>
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 服务器：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('server',"{$email->server}",['required','lay-verify'=>'required','placeholder'=>'请输入邮件服务器','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 端口：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('port',"{$email->port}",['required','lay-verify'=>'required','placeholder'=>'请输入邮件发送端口','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 发件人：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-inline">
                        {!! Form::email('sender',"{$email->sender}",['required','lay-verify'=>'required','placeholder'=>'请输入发件人地址','id'=>'email_3','class'=>'layui-input']) !!}
                    </div>
                    <a href="javascript:void(0);" onclick="captcha('0',3,'{{route('code')}}','{{ csrf_token() }}')"
                       id="code_de_3"
                       style="margin:10px;text-align: center">发送验证码</a>
                    <span style="color: red">注：无更改无需发送</span>
                </div>
                <div class="layui-form-item" id="email_code_3" style="display: none;">
                    {!! Form::label('','* 邮箱验证码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-inline">
                        {!! Form::text('code','',['placeholder'=>'无更改无需填写','id'=>'code_3','readonly','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 名称：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('name',"{$email->name}",['required','lay-verify'=>'required','placeholder'=>'请输入发件人名称','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 用户名：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('username',"{$email->username}",['required','lay-verify'=>'required','placeholder'=>'请输入用户名','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 密码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('password',"{$email->password}",['required','lay-verify'=>'required','placeholder'=>'请输入密码','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'emailInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <!--收件邮箱-->
            <div class="layui-tab-item">
                {!! Form::open(['route' => 'system.config.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','5') !!}
                {!! Form::hidden('submit','6') !!}
                <div class="layui-form-item">
                    {!! Form::label('','邮箱模式：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <input type="radio" name="imap" value="{{$emailHair->imap}}" title="IMAP函数收件"
                               @if($emailHair->imap) checked @endif>
                        <eq style="color:red">目前仅支持QQ邮箱</eq>
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 服务器：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('server',"{$emailHair->server}",['required','lay-verify'=>'required','placeholder'=>'请输入获取邮件服务器','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 端口：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('port',"{$emailHair->port}",['required','lay-verify'=>'required','placeholder'=>'请输入获取邮件端口','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 发件人：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-inline">
                        {!! Form::email('sender',"{$emailHair->sender}",['required','lay-verify'=>'required','placeholder'=>'请输入获取收件人地址','id'=>'email_6','class'=>'layui-input']) !!}
                    </div>
                    <a href="javascript:void(0);" onclick="captcha('0',6,'{{route('code')}}','{{ csrf_token() }}')"
                       id="code_de_6"
                       style="margin:10px;text-align: center">发送验证码</a>
                    <span style="color: red">注：无更改无需发送</span>
                </div>
                <div class="layui-form-item" id="email_code_6" style="display: none;">
                    {!! Form::label('','* 邮箱验证码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-inline">
                        {!! Form::text('code','',['placeholder'=>'无更改无需填写','id'=>'code_6','readonly','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 名称：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('name',"{$emailHair->name}",['required','lay-verify'=>'required','placeholder'=>'请输入发件人名称','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 用户名：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('username',"{$emailHair->username}",['required','lay-verify'=>'required','placeholder'=>'请输入用户名','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','* 密码：',['class'=>'layui-form-label','style'=>'color:red']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('password',"{$emailHair->password}",['required','lay-verify'=>'required','placeholder'=>'请输入密码','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'companyInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <!--公司信息配置-->
            <div class="layui-tab-item">
                {!! Form::open(['route' => 'system.config.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','4') !!}
                <div class="layui-form-item">
                    {!! Form::label('','公司名称：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('company',"{$config->company}",['placeholder'=>'请输入公司名称','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','QQ：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('qq',"{$config->qq}",['placeholder'=>'请输入QQ','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','手机号：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('phone',"{$config->phone}",['placeholder'=>'请输入手机号','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','固定号码：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('fixed',"{$config->fixed}",['placeholder'=>'请输入固定号码','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    {!! Form::label('','传真号码：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        {!! Form::text('fax',"{$config->fax}",['placeholder'=>'请输入传真号码','class'=>'layui-input']) !!}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'companyInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <div class="layui-tab-item">
                <br>
                {!! Form::open(['route' => 'upload','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','enctype'=>'multipart/form-data','method'=>'post']) !!}
                <div class="layui-form-item">
                    {!! Form::label('','网站图标：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <div class="user-headface" style="width: 80px;">
                            <img title="网站图标" alt="{{$config->name}}" id="img_show"
                                 style="margin:-10px;width: 60px;height: 60px;border-radius: 50%;"
                                 src="@if(isset($config->file->url)){{assetImage($config->file->url) ? : asset('static/admin/icon/35508.png')}}@else {{asset('static/admin/icon/35508.png')}}@endif">
                        </div>
                    </div>
                </div>
                <br>
                <div class="layui-form-item">
                    {!! Form::label('','上传：',['class'=>'layui-form-label']) !!}
                    <div class="layui-input-block">
                        <div class="layui-box layui-upload-button">
                            {!! Form::hidden('category','config') !!}
                            {!! Form::hidden('user','admin') !!}
                            {!! Form::hidden('get','file') !!}
                            {!! Form::file('file',['id'=>'file0','onchange'=>'previewImage(this,0)']) !!}
                            <span class="layui-upload-icon"><i class="layui-icon"></i>上传图片</span>
                        </div>
                    </div>
                </div>
                <br>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'adminUpload','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
            <!--配置系统数据-->
            <div class="layui-tab-item">
                {!! Form::open(['route' => 'system.config.store','class'=>'layui-form','style'=>'width: 90%;padding-top: 20px;','method'=>'put']) !!}
                {!! Form::hidden('status','6') !!}
                {!! Form::hidden('filter','true') !!}
                <div class="layui-form-item">
                    {!! Form::textarea('page',"{$page}",['placeholder'=>'请输入环境变量','style'=>'height: -webkit-fill-available;','class'=>'layui-textarea']) !!}
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {!! Form::submit('立即提交',['class'=>'layui-btn layui-btn-normal','lay-filter'=>'emailInfo','lay-submit']) !!}
                    </div>
                </div>
                {!! Form::close() !!}
            </div>
        </div>
    </div>
    <script src="{{asset('static/admin/layui/layui.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="{{asset('js/jquery.base64.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/jquery.cookie.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/upload.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/common.js')}}"></script>
    <script>
        var img = $('#img_show').attr('src');
        var title = $('#name').val();

        $('#icon', window.parent.document).attr('src', img);
        $('#icons', window.parent.document).attr('src', img);

        $('#title', window.parent.document).text(title);

        captchaInput(2);
        captchaInput(3);
        captchaInput(6);
        //Demo
        layui.use(['form', 'element'], function () {
            var form = layui.form();
            var element = layui.element();
            form.render();
            //监听信息提交
            form.on('submit(siteInfo)', function (data) {
            });
            //监听seo提交
            form.on('submit(seoInfo)', function (data) {
            });
            //监听seo提交
            form.on('submit(emailInfo)', function (data) {
            });
            //监听评论提交
            form.on('submit(companyInfo)', function (data) {
            });
        });
    </script>
    </body>
@endsection
